Skip to content

sEPD Event Plane Calibration - Application#4127

Merged
pinkenburg merged 11 commits intosPHENIX-Collaboration:masterfrom
Steepspace:sEPD-Calib
Feb 24, 2026
Merged

sEPD Event Plane Calibration - Application#4127
pinkenburg merged 11 commits intosPHENIX-Collaboration:masterfrom
Steepspace:sEPD-Calib

Conversation

@Steepspace
Copy link
Contributor

@Steepspace Steepspace commented Jan 20, 2026

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

Introduces a new sEPD event plane reconstruction module (v2) and an expanded info container (v2) to support a full calibration chain including recentering and flattening.

Eventplaneinfov2:

  • Inherits from Eventplaneinfo.
  • Adds dedicated storage for raw, recentered, and final (flattened) Q-vectors.
  • Provides getters/setters for extended Q-vector stages to allow for systematic studies of calibration effects.

EventPlaneRecov2:

  • New SubsysReco module specifically for sEPD Q-vector calibration.
  • Implements a multi-step calibration workflow:
    1. Raw Q-vector calculation from sEPD channel charges and geometry.
    2. Recentering: Subtracts offsets per centrality bin.
    3. Flattening: Applies a 2x2 correction matrix calculated from Q-vector variances (Qxx, Qyy, Qxy).
  • Features integration with CDBTTree to load calibration parameters dynamically via the Calibration Database.
  • Processes harmonics n=2,3, and 4 for South, North, and Combined (NS) subdetectors.
  • Automatically handles centrality-based binning (8 bins) for calibrations.
  • Populates EventplaneinfoMap with Eventplaneinfov2 objects for downstream analysis.
  • Includes diagnostic verbosity levels for inspecting calibration matrices and per-event vector transformations.

Presentations:

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

sEPD Q Vector Calibration Generation: #4106
sEPD Q Vector Calibration Generation (macros): sPHENIX-Collaboration/macros#1270

sEPD Event Plane Calibration – Application (PR #4127)

Motivation & Context

Enable a full, centrality‑dependent sEPD Q‑vector calibration and event‑plane production chain to improve event‑plane accuracy and support systematic studies. Moves calibration storage from many TProfile histograms to a compact CDBTTree format, adds recentering and 2×2 flattening corrections applied directly to Q‑vectors, and provides a v2 reconstruction implementation while preserving the legacy class for backward compatibility.

Key changes

  • New eventplane data type: Eventplaneinfov2

    • Derives from Eventplaneinfo and exposes/setters for raw, recentered, and final (flattened) Q‑vectors, shifted‑psi, and ring Q‑vector accessors.
    • Implements safe NaN returns for out‑of‑range queries.
  • New reconstruction module: EventPlaneRecov2 (SubsysReco)

    • Full workflow: compute raw Q‑vectors from sEPD tower charges and geometry → recenter using per‑centrality offsets → flatten via precomputed 2×2 matrices based on Q‑variance terms.
    • Supports harmonics n = 2, 3, 4 for South, North, and Combined (NS).
    • Uses 8 centrality bins and loads calibration parameters from CDBTTree (Calibration DB or direct URL).
    • Stores raw, recentered, and flattened Q‑vectors per event into EventplaneinfoMap (Eventplaneinfov2 objects).
    • Diagnostic verbosity to print calibration matrices and per‑event Q‑vector transformations.
    • Safety guards for missing/invalid calibration entries, singular/near‑singular matrix cases, zero total charge, and order==0.
  • Build / integration

    • Added headers/sources/dictionaries for Eventplaneinfov2 and EventPlaneRecov2 and updated Makefile.am to export them.
    • CaloTowerStatus: hot‑map calibration selection extended to include SEPD (previously only CEMC).
  • Implementation notes

    • Flattening matrices computed via calculate_flattening_matrix; identity returned on invalid determinants or N‑term.
    • LoadCalib reads many per‑harmonic/per‑cent/bin fields from CDBTTree and precomputes X_matrices; calibration tree is deleted after loading.
    • Config flags: direct calib URL, abort-on-missing-calib, minimum channel charge, and options to skip calibration.

Potential risk areas

  • IO / on‑disk format: Calibration storage changed to CDBTTree — tooling, calibration generation, and deployment must support this format and ensure files are available and consistent.
  • Reconstruction behavior: Centrality‑dependent recentering and flattening change event‑plane extraction vs. legacy EventPlaneReco; expect systematic shifts — validate physics impact across harmonics/subdetectors.
  • Downstream compatibility: New Eventplaneinfov2 adds virtual accessors and additional Q‑vector representations; code assuming the old interface or binary layouts may require updates.
  • Numerical stability: Matrix computations guard common failure modes, but near‑singular or low‑charge events need validation and targeted tests.
  • Thread‑safety / concurrency: SubsysReco state appears instance‑local, but shared calibration/data objects and multi‑threaded execution should be reviewed for race conditions.
  • Performance: Per‑event operations are lightweight but diagnostic printing, calibration loading, and potential memory behavior should be profiled in large workflows.
  • Failure modes & batch behavior: Configurable abort/skip on missing calibration impacts batch runs — ensure expected behavior in production workflows.

Possible future improvements

  • Add unit and integration tests for flattening math, recentering, and edge cases (zero charge, singular matrices).
  • CI/validation jobs to compare EventPlaneRecov2 vs. legacy EventPlaneReco (distributions, psi shifts by centrality/harmonic).
  • Make harmonics, centrality bins, and thresholds configurable at runtime via job options or external config.
  • Documentation and migration guidance for CDBTTree calibration format and calibration-generation tools.
  • Add automated checks/plots when loading calibration trees and commissioning diagnostics.
  • Profile and optimize hot paths if throughput becomes a concern in high‑statistics processing.

Note: AI-generated summaries can contain mistakes. Reviewers should inspect Q‑vector math, calibration loading behavior, node population, and run validation with real calibration data before adoption.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 876b96f and 37a596e.

📒 Files selected for processing (1)
  • offline/packages/CaloReco/CaloTowerStatus.cc

📝 Walkthrough

Walkthrough

Adds a new EventPlaneRecov2 SubsysReco and Eventplaneinfov2 container for event-plane calibration/Q‑vector handling, extends Eventplaneinfo interface, includes SEPD in CaloTowerStatus hot-map selection, and updates build files to expose new headers/sources and ROOT dictionaries.

Changes

Cohort / File(s) Summary
Calorimeter Calibration
offline/packages/CaloReco/CaloTowerStatus.cc
Removed unused TowerInfo includes; expanded hot-map calibration condition so m_calibName_hotMap applies for m_dettype == CEMC or SEPD (uses m_detector + "_BadTowerMap" for SEPD as well).
Event Plane Recovery Subsystem
offline/packages/eventplaneinfo/EventPlaneRecov2.h, offline/packages/eventplaneinfo/EventPlaneRecov2.cc
New SubsysReco implementing calibration loading (direct URL or calib tree), centrality handling, sEPD tower processing, raw Q-vector accumulation, recentering and flattening per-harmonic/cent_bin, node creation, EventplaneinfoMap population, and lifecycle hooks.
Event Plane Info Interface
offline/packages/eventplaneinfo/Eventplaneinfo.h
Renamed include guard, replaced with , added virtual methods for raw/recentered Q-vectors (set_qvector_raw, set_qvector_recentered, get_qvector_raw, get_qvector_recentered), and standardized NaN returns via std::numeric_limits<double>::quiet_NaN().
Eventplaneinfo v2 (types & IO)
offline/packages/eventplaneinfo/Eventplaneinfov2.h, offline/packages/eventplaneinfo/Eventplaneinfov2.cc, offline/packages/eventplaneinfo/Eventplaneinfov2LinkDef.h
Added Eventplaneinfov2 class (stores standard/raw/recentered Q‑vectors, shifted psi, ring Q‑vectors), implements identify() and GetPsi(), and added ROOT LinkDef for dictionary generation.
Build Configuration
offline/packages/eventplaneinfo/Makefile.am
Added new public headers (Eventplaneinfov2.h, EventPlaneRecov2.h), sources (Eventplaneinfov2.cc, EventPlaneRecov2.cc), ROOT dict (Eventplaneinfov2_Dict.cc), and updated SOURCES/ROOTDICTS to build/install v2 and Recov2 artifacts.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Recov as EventPlaneRecov2
    participant CDB as CDB/Calib
    participant EH as EventHeader
    participant SEPD as SEPD_Towers
    participant Cent as CentralityInfo
    participant DST as DST/Nodes

    Client->>Recov: Init(topNode)
    Recov->>CDB: Load calibration (direct URL or calib dir)
    CDB-->>Recov: CorrectionData per harmonic/cent_bin
    Recov->>Recov: LoadCalib() (store averages & X-matrices)

    Client->>Recov: process_event(topNode)
    Recov->>EH: Read global event index
    Recov->>Cent: Read CentralityInfo
    Cent-->>Recov: cent_bin

    Recov->>SEPD: process_sEPD() (read towers, accumulate charges)
    SEPD-->>Recov: raw Q-vectors (S, N, NS)
    Recov->>Recov: correct_QVecs() (recenter then apply flattening matrices)

    Recov->>DST: FillNode(topNode) (create/insert EventplaneinfoMap entries)
    DST-->>Recov: confirm insertion

    Client->>Recov: ResetEvent(topNode)
    Recov->>Recov: clear per-event state
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit eb122648a02f13af194f74a9af44e64934e2ea02:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg
Copy link
Contributor

There will be more comments but why do you add a version 2 of the reconstruction class? As far as I know this here is a replacement - is there any point in running the old version?

@Steepspace
Copy link
Contributor Author

There will be more comments but why do you add a version 2 of the reconstruction class? As far as I know this here is a replacement - is there any point in running the old version?

Hi Chris, yes this will be a replacement for the EventPlaneReco module as there are a few key differences:

  • The calibrations are stored more compactly in CDBTTree format vs the old approach that stored the many TProfile histograms that took up lots of space.
  • The calibrations are now centrality dependent whereas before they were not.
  • The calibration acts directly on the Q Vectors (especially the second order correction (flattening)).

I did not want to just outright delete and replace the contents of EventPlaneReco in case that would cause breakages downstream for any existing code that uses the EventPlaneReco module.

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 760d32daa74846e600de6a512c93824da8d4f684:
Jenkins on fire

Build & test report

Report for commit 561e967652518788cb59cd7b23a726994d5bef0e:
Jenkins on fire

Build & test report

Report for commit 3fa48da17176b340a61716e6a0ab2aa69ea4894d:
Jenkins on fire

Build & test report

Report for commit 9ec298fb7d3b94a243e8056445b7879d11f58659:
Jenkins on fire

Build & test report

Report for commit 18c5a2c56900618bcf9798bb091f064b628994a4:
Jenkins on fire

Build & test report

Report for commit f704495167ff5a179e3b400f49850351b7084714:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 1e206178d882a77d662fe8517b6f9901b826eab1:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@Steepspace Steepspace marked this pull request as ready for review January 30, 2026 19:04
Copilot AI review requested due to automatic review settings January 30, 2026 19:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an sEPD-specific event-plane reconstruction and calibration application, wiring it to the new CDB-based Q-vector calibration payloads and extending the event-plane info container to hold multiple calibration stages.

Changes:

  • Introduces Eventplaneinfov2, extending the event-plane info interface to hold raw, recentered, and final (flattened) Q-vectors and derived angles.
  • Adds EventPlaneRecov2, a SubsysReco module that computes sEPD Q-vectors for harmonics 2–4, applies centrality-binned recentering and 2×2 flattening matrices from CDBTTree, and fills the EventplaneinfoMap with Eventplaneinfov2 nodes.
  • Extends CaloTowerStatus handling so SEPD uses the _BadTowerMap convention for hot/bad channel maps, aligning sEPD operations with CEMC.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
offline/packages/eventplaneinfo/Makefile.am Registers Eventplaneinfov2 and EventPlaneRecov2 headers, implementations, and ROOT dictionaries with the build, so the new container and module are compiled and available.
offline/packages/eventplaneinfo/Eventplaneinfov2LinkDef.h Adds ROOT CINT dictionary directives for Eventplaneinfov2, enabling persistence and I/O via ROOT.
offline/packages/eventplaneinfo/Eventplaneinfov2.h Defines Eventplaneinfov2 as a subclass of Eventplaneinfo, adding storage and accessors for raw, recentered, and flattened Q-vectors, plus ring-resolved Q-vectors and psi accessors.
offline/packages/eventplaneinfo/Eventplaneinfov2.cc Implements identify and a concrete GetPsi method (handling the Q=(0,0) case with NaN), providing core angle computation for the new container.
offline/packages/eventplaneinfo/Eventplaneinfo.h Extends the base interface to include virtual hooks for raw and recentered Q-vectors, so downstream code can use these in a type-agnostic way via Eventplaneinfo*.
offline/packages/eventplaneinfo/EventPlaneRecov2.h Declares the new EventPlaneRecov2 SubsysReco module, including configuration knobs, CDBTTree handle, correction-data structures, and internal Q-vector state for harmonics 2–4 across S/N/NS.
offline/packages/eventplaneinfo/EventPlaneRecov2.cc Implements the sEPD event-plane reconstruction pipeline: loads per-harmonic, per-centrality recentering and flattening data from CDB, computes charge-weighted Q-vectors from TOWERINFO_CALIB_SEPD, applies recentering and 2×2 matrix flattening, and populates EventplaneinfoMap with Eventplaneinfov2 records for sEPDS, sEPDN, and sEPDNS (including raw and recentered vectors).
offline/packages/eventplaneinfo/Eventplaneinfo.cc (unchanged content, but used by new code) Existing implementation remains the common base; new v2 class plugs into this hierarchy without altering behavior of v1 users.
offline/packages/CaloReco/CaloTowerStatus.cc Adjusts hot-map calibration name selection so SEPD uses the same _BadTowerMap naming convention as CEMC, allowing SEPD bad tower maps produced by the calibration pipeline to be picked up automatically.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

@Steepspace Steepspace marked this pull request as draft January 30, 2026 19:18
@Steepspace
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 1, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 67ab2c156e2c3998324091661011e038f35cb04c:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

Introduces a new sEPD event plane reconstruction module (v2) and an expanded info container (v2) to support a full calibration chain including recentering and flattening.

Eventplaneinfov2:
- Inherits from Eventplaneinfo.
- Adds dedicated storage for raw, recentered, and final (flattened) Q-vectors.
- Provides getters/setters for extended Q-vector stages to allow for systematic studies of calibration effects.

EventPlaneRecov2:
- New SubsysReco module specifically for sEPD Q-vector calibration.
- Implements a multi-step calibration workflow:
    1. Raw Q-vector calculation from sEPD channel charges and geometry.
    2. Recentering: Subtracts <Q> offsets per centrality bin.
    3. Flattening: Applies a 2x2 correction matrix calculated from Q-vector variances (Qxx, Qyy, Qxy).
- Features integration with CDBTTree to load calibration parameters dynamically via the Calibration Database.
- Processes harmonics n=2,3, and 4 for South, North, and Combined (NS) subdetectors.
- Automatically handles centrality-based binning (8 bins) for calibrations.
- Populates EventplaneinfoMap with Eventplaneinfov2 objects for downstream analysis.
- Includes diagnostic verbosity levels for inspecting calibration matrices and per-event vector transformations.
- Allow the sEPD bad tower maps to be processed via the CaloTowerStatus module.
Integrate the "Combined NS" calibration strategy into the reconstruction pipeline to improve event plane resolution and flatness. This update treats the combined North-South detector as a distinct third entity for flattening, while preserving multiplicity-based resolution weighting through individual sub-detector recentering.

Core Logic Updates:
- Calibration Loading: Updated LoadCalib to retrieve North-South specific second moments (⟨Qx2​⟩, ⟨Qy2​⟩, ⟨Qx​Qy​⟩) from the Calibration Database (CDB).
- Matrix Computation: Implemented unique flattening matrix calculation for the NS detector slot (Index 2) during initialization.
1) "Best of Both Worlds" Correction: Refactored correct_QVecs to implement the optimized combination logic:
2) Recenters South and North vectors individually.
3) Sums the recentered components to form the combined recentered vector: Q_NS,rec​ = Q_S,rec ​+ Q_N,rec​.

- Applies the dedicated NS flattening matrix to the resulting sum to ensure a circular (flat) distribution.
- Raw Vector Summation: Updated process_sEPD to populate the raw NS vector by summing normalized sub-detector components, facilitating direct QA comparisons.

Infrastructure & Efficiency:
- Array Expansion: Increased internal storage arrays for m_correction_data, m_Q_raw, m_Q_recentered, and m_Q_flat from size 2 to size 3 to accommodate the NS detector index.

Diagnostics & Quality Assurance:
- Print Methods: Expanded print_correction_data and print_QVectors to display diagnostic information for all three detector slots (South, North, and NorthSouth).
- Fallback Safety: Maintained fallback logic that utilizes raw Q-vectors in the event of missing calibration data or invalid event centrality, preventing empty output nodes.
Address Major Issues:
- Ensure m_directURL_EventPlaneCalib is not empty before passing it to hasValidTree
- Removed unused vectors in EventPlaneRecov2 (south_psi, north_psi, northsouth_psi)
- Guard against order == 0 to avoid divide-by-zero.
- Add bounds checks before indexing Q-vector storage.
@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 8b5c354c39a7ed64cae634b3bc9139e6a699c85d:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg pinkenburg marked this pull request as ready for review February 23, 2026 21:39
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
offline/packages/eventplaneinfo/EventPlaneRecov2.cc (1)

38-38: ⚠️ Potential issue | 🟠 Major

#include <format> requires C++20 — build may fail.

This file includes <format> and uses std::format extensively (~37 call sites) as well as std::ranges::max_element (line 513). The project's configure.ac does not enforce -std=c++20. If the default compiler standard is C++17, this will not compile.

Consider replacing std::format with std::ostringstream or a lightweight formatting approach (e.g., boost::format or the fmt library, which is the reference implementation for std::format and works under C++11/14/17).


ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67ab2c1 and 876b96f.

📒 Files selected for processing (8)
  • offline/packages/CaloReco/CaloTowerStatus.cc
  • offline/packages/eventplaneinfo/EventPlaneRecov2.cc
  • offline/packages/eventplaneinfo/EventPlaneRecov2.h
  • offline/packages/eventplaneinfo/Eventplaneinfo.h
  • offline/packages/eventplaneinfo/Eventplaneinfov2.cc
  • offline/packages/eventplaneinfo/Eventplaneinfov2.h
  • offline/packages/eventplaneinfo/Eventplaneinfov2LinkDef.h
  • offline/packages/eventplaneinfo/Makefile.am
🚧 Files skipped from review as they are similar to previous changes (1)
  • offline/packages/CaloReco/CaloTowerStatus.cc

Comment on lines +48 to +86
int EventPlaneRecov2::Init(PHCompositeNode *topNode)
{
std::string calibdir = CDBInterface::instance()->getUrl(m_calibName);

if (!m_directURL_EventPlaneCalib.empty())
{
m_cdbttree = new CDBTTree(m_directURL_EventPlaneCalib);
std::cout << PHWHERE << " Custom Event Plane Calib Found: " << m_directURL_EventPlaneCalib << std::endl;
}
else if (!calibdir.empty())
{
m_cdbttree = new CDBTTree(calibdir);
std::cout << PHWHERE << " Event Plane Calib Found: " << calibdir << std::endl;
}
else if (m_doAbortNoEventPlaneCalib)
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found and m_doAbortNoEventPlaneCalib is true. Aborting." << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}
else
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found. Skipping Event Plane Calibrations." << std::endl;
m_doNotCalib = true;
}

if (!m_doNotCalib)
{
LoadCalib();
}

if (Verbosity() > 0)
{
print_correction_data();
}

CreateNodes(topNode);

return Fun4AllReturnCodes::EVENT_OK;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, find the EventPlaneRecov2 files to understand the complete context
find . -name "EventPlaneRecov2*" -type f | head -20

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 184


🏁 Script executed:

# Check if EventPlaneRecov2 has an InitRun() implementation
grep -n "InitRun" $(find . -name "EventPlaneRecov2*" -type f) 2>/dev/null | head -20

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 60


🏁 Script executed:

# Find CreateNodes implementation to see what it returns
grep -n "CreateNodes" $(find . -name "EventPlaneRecov2*" -type f) 2>/dev/null

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 385


🏁 Script executed:

# Look at standard pattern: check how other SubsysReco/reconstruction modules handle CDB
echo "=== Searching for CDB loading patterns in reconstruction modules ==="
rg "CDBInterface.*getUrl|CDBTTree" --type cpp -B 5 -A 5 | grep -E "(Init\(|InitRun\(|getUrl|CDBTTree)" | head -50

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 5161


🏁 Script executed:

# Find all files that use both CDBInterface and have InitRun defined
echo "=== Modules with InitRun and CDB usage ==="
find . -name "*.cc" -type f | xargs grep -l "InitRun" | head -10 | while read f; do
  if grep -q "CDBInterface\|CDBTTree\|getUrl" "$f"; then
    echo "File: $f"
    grep -n "int.*InitRun\|int.*Init\|getUrl\|CDBTTree" "$f" | head -10
    echo "---"
  fi
done

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1316


🏁 Script executed:

# Check if EventPlaneRecov2 declares/implements InitRun
cat -n ./offline/packages/eventplaneinfo/EventPlaneRecov2.h | head -100

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 3301


🏁 Script executed:

# Check what function in EventPlaneRecov2.cc loads CDB and in which function
grep -n "int EventPlaneRecov2::" ./offline/packages/eventplaneinfo/EventPlaneRecov2.cc | head -20

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 529


🏁 Script executed:

# More specifically, check the Init and InitRun signatures in the header
grep -A 2 -B 2 "Init" ./offline/packages/eventplaneinfo/EventPlaneRecov2.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 209


🏁 Script executed:

# Now check ZdcReco to see if it's a counter-example (CDB in Init not InitRun)
grep -n "int.*Init\|getUrl\|CDBTTree" ./offline/packages/zdcinfo/ZdcReco.cc | head -20

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 297


🏁 Script executed:

# Check the structure of one of the standard pattern modules more carefully
echo "=== emcNoisyTowerFinder pattern ==="
grep -n "int.*Init" ./calibrations/calorimeter/calo_emc_noisy_tower/emcNoisyTowerFinder.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 180


🏁 Script executed:

# Check the CreateNodes function return value handling
sed -n '249,275p' ./offline/packages/eventplaneinfo/EventPlaneRecov2.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 974


🏁 Script executed:

# Check what happens at line 83 in Init where CreateNodes is called
sed -n '48,90p' ./offline/packages/eventplaneinfo/EventPlaneRecov2.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1351


🏁 Script executed:

# Check the event processing to see if it would crash if EventplaneinfoMap doesn't exist
sed -n '504,520p' ./offline/packages/eventplaneinfo/EventPlaneRecov2.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1244


Ignoring CreateNodes() return value will mask initialization errors

Line 83 calls CreateNodes(topNode) but discards its return value. CreateNodes() returns ABORTRUN when the DST node is missing, but Init() proceeds to return EVENT_OK anyway. This silently masks critical errors—if DST doesn't exist, the module will initialize as if successful, only to crash later in FillNode() when trying to access the EventplaneinfoMap. Check and propagate the return value:

-  CreateNodes(topNode);
-
-  return Fun4AllReturnCodes::EVENT_OK;
+  return CreateNodes(topNode);

CDB calibrations should be loaded in InitRun(), not Init()

The standard pattern across this codebase (ZdcReco, emcNoisyTowerFinder, InttCalib, etc.) is to load CDB calibrations in InitRun(), where the run number is guaranteed to be available. Calliing CDBInterface::instance()->getUrl() in Init() before the run is known can return stale or incorrect calibration URLs. Implement InitRun() and move the calibration-loading logic there.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
int EventPlaneRecov2::Init(PHCompositeNode *topNode)
{
std::string calibdir = CDBInterface::instance()->getUrl(m_calibName);
if (!m_directURL_EventPlaneCalib.empty())
{
m_cdbttree = new CDBTTree(m_directURL_EventPlaneCalib);
std::cout << PHWHERE << " Custom Event Plane Calib Found: " << m_directURL_EventPlaneCalib << std::endl;
}
else if (!calibdir.empty())
{
m_cdbttree = new CDBTTree(calibdir);
std::cout << PHWHERE << " Event Plane Calib Found: " << calibdir << std::endl;
}
else if (m_doAbortNoEventPlaneCalib)
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found and m_doAbortNoEventPlaneCalib is true. Aborting." << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}
else
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found. Skipping Event Plane Calibrations." << std::endl;
m_doNotCalib = true;
}
if (!m_doNotCalib)
{
LoadCalib();
}
if (Verbosity() > 0)
{
print_correction_data();
}
CreateNodes(topNode);
return Fun4AllReturnCodes::EVENT_OK;
}
int EventPlaneRecov2::Init(PHCompositeNode *topNode)
{
std::string calibdir = CDBInterface::instance()->getUrl(m_calibName);
if (!m_directURL_EventPlaneCalib.empty())
{
m_cdbttree = new CDBTTree(m_directURL_EventPlaneCalib);
std::cout << PHWHERE << " Custom Event Plane Calib Found: " << m_directURL_EventPlaneCalib << std::endl;
}
else if (!calibdir.empty())
{
m_cdbttree = new CDBTTree(calibdir);
std::cout << PHWHERE << " Event Plane Calib Found: " << calibdir << std::endl;
}
else if (m_doAbortNoEventPlaneCalib)
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found and m_doAbortNoEventPlaneCalib is true. Aborting." << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}
else
{
std::cout << PHWHERE << " Error: No Event Plane Calib Found. Skipping Event Plane Calibrations." << std::endl;
m_doNotCalib = true;
}
if (!m_doNotCalib)
{
LoadCalib();
}
if (Verbosity() > 0)
{
print_correction_data();
}
return CreateNodes(topNode);
}

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 876b96f25a59f3d5b93353a417aade587468e160:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 37a596e5a70cd94be99288a7a3db2817844c85f8:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg pinkenburg merged commit 96bcb9e into sPHENIX-Collaboration:master Feb 24, 2026
22 checks passed
@Steepspace Steepspace deleted the sEPD-Calib branch February 27, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants